package org.wk.abstrct;

abstract class Animal {
    // 抽象方法
    abstract void makeSound();

    // 非抽象方法
    void breathe() {
        System.out.println("Breathing...");
    }
}

class Dog extends Animal {
    @Override
    void makeSound() {
        System.out.println("Bark!");
    }
}

class Cat extends Animal {
    @Override
    void makeSound() {
        System.out.println("Meow!");
    }

}

class Test{
    public static void main(String[] args) {
        Dog dog=new Dog();
        dog.makeSound();
        dog.breathe();
        Animal d=new Dog();
        d.breathe();
        d.makeSound();
        Animal cat=new Cat();
        cat.makeSound();
        cat.breathe();
    }
}
